package com.fyy.minio.controller;

import com.fyy.minio.utils.MinioUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
public class MinioController {

    @Autowired
    private MinioUtils minioUtils;

    private String ipPath =  "http://127.0.0.1:9000";
    private String bucketName = "test";

    @RequestMapping("/upload")
    public String upload(MultipartFile file){
        List<String> result = minioUtils.uploadFiles(new MultipartFile[]{file});
        return ipPath + "/" + bucketName + "/" +result.get(0);
    }
    
}
